package resoft.jeasyform.components;

import java.util.Collection;
import java.util.ArrayList;

/**
 * <p></p>
 * User: albert
 * Date: Aug 30, 2007
 * Time: 2:01:48 PM
 */
public class MenuItem {


    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public String getClickedEvent() {
        return clickedEvent;
    }


    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        this.width = width;
    }

    public void setClickedEvent(String clickedEvent) {
        this.clickedEvent = clickedEvent;
    }

    /**
     * add child menuItem
     *
     * @param item MenuItem
     */
    public void addChild(MenuItem item) {
        children.add(item);
    }

    /**
     * judge is it has children menus
     *
     * @return boolean .if it has children,return true,else return false;
     */
    public boolean hasChildren() {
        return children.size() > 0;
    }

    /**
     * find all children
     *
     * @return Collection childeren
     */
    public Collection getChildren() {
        return children;
    }


    private String text;
    private int width;
    private String clickedEvent;
    private int id;

    private Collection children = new ArrayList();
}
